<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鲜淘驿站 - 后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="/static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/static/css/main.css">
    <script type="text/javascript" src="/static/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            $(".dels").click(function () {
                if (!confirm("是否删除？")) {
                    return false
                }
            })
            $("#select").change(function () {
                $("#form").submit()
            })
        }
    </script>
</head>
<body>
{{ template "comm/header.html" }}
{{ template "comm/side_bar.html"}}

<div class="main_body" id="main_body">
    <div class="breadcrub">
        当前位置：文章管理>文章列表
    </div>
    <div class="pannel">
        <span class="sel_label">请选择文章分类：</span>
        <form id="form" method="get" action="/">
            <select name="select" id="select" class="sel_opt">
                {{range .goodTypes}}
                    {{if compare $.goodsTypeName .Name}}
                        <option selected="true">{{.Name}}</option>
                    {{else}}
                        <option>{{.Name}}</option>
                    {{end}}
                {{end}}
            </select>
            <input type="submit" hidden="hidden">
        </form>

        <table class="common_table">
            <tr>
                <th width="31%">商品标题</th>
                <th width="5%">商品描述</th>
                <th width="16%">添加时间</th>
                <th width="7%">库存量</th>
                <th width="10%">商品类型</th>
                <th width="10%">商品价格</th>
                <th width="7">销量</th>
                <th width="7%">删除</th>
                <th width="7%">编辑</th>

            </tr>
            {{range $index ,$val := .goodSKUs}}
                <tr>
                    <td>{{$val.Name}}</td>
                    <td><a href="/admin/goods-detail?id={{$val.Id}}">查看详情</a></td>
                    <td> {{$val.Time.Format "2006-01-02 15:04:05"}}</td>
                    <td>{{$val.Stock}}</td>
                    <td>{{$val.GoodsType.Name}}</td>
                    <td>{{$val.Price}}</td>
                    <td>{{$val.Sales}}</td>
                    <td><a href="/admin/goods-delete?id={{$val.Id}}" class="dels">删除</a></td>
                    <td><a href="/admin/goods-update?id={{$val.Id}}">编辑</a></td>

                </tr>
            {{end}}
        </table>

        <ul class="pagenation">
            <li><a href="/?pageIndex=1&select={{.goodsTypeName}}">首页</a></li>
            {{if compare .FirstPage true}}
                <li>上一页</li>
            {{else}}
                <li><a href="/?pageIndex={{ .pageIndex | ShowPrePage}}&select={{.goodsTypeName}}">上一页</a>
                </li>
            {{end}}
            {{if compare .EndPage true}}
                <li>下一页</li>
            {{else}}
                <li>
                    <a href="/?pageIndex={{.pageIndex | ShowNextPage}}&select={{ .goodsTypeName }}">下一页</a>
                </li>
            {{end}}
            <li><a href="/?pageIndex={{.pageCount}}" &select={{.typeName}}>末页</a></li>
            <li>共{{.count}}条记录/共{{.pageCount}}页/当前{{.pageIndex}}页</li>
        </ul>
    </div>
</div>

</body>
</html>
